{extend name="base" /}
{block name="content"}
<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="{:url('index/welcome')}"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>系统</span>
            <span class="icon-angle-right"></span>
            <span>幻灯片</span>
            <span class="icon-angle-right"></span>
            <span>{$info ? '编辑' : '添加'}幻灯片</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">
            <div class="m-form">
                <form class="layui-form" id="j_form">
                    <table class="m-table">
                        <thead>
                        <tr>
                            <th colspan="2">{$info ? '编辑' : '添加'}幻灯片</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td width="15%"><label for="title">幻灯片标题<em>*</em></label></td>
                            <td><input type="text" class="u-ipt u-ipt-long" name="title" id="title" placeholder="请输入幻灯片标题" value="{$info.title}" /></td>
                        </tr>
                        <tr>
                            <td><label for="">幻灯片分类<em>*</em></label></td>
                            <td>
                                <div class="lay-select">
                                    <select name="category_id">
                                        <option value="0">请选择幻灯片分类</option>
                                        {foreach name="categories" item="category"}
                                        <option value="{$category.id}"{if condition="$info['category_id'] eq $category['id']"} selected{/if}>{$category.name}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </td>
                        </tr>
<!--                        {foreach name="html" item="v"}-->
<!--                        {if condition="$v['type'] eq 'editor'"}-->
<!--                        <tr>-->
<!--                            <td colspan="2">{:html_entity_decode($v.label)}</td>-->
<!--                        </tr>-->
<!--                        <tr>-->
<!--                            <td colspan="2">{:html_entity_decode($v.value)}</td>-->
<!--                        </tr>-->
<!--                        <script>-->
<!--                            KindEditor.ready(function(K) {-->
<!--                                var editor = K.create('textarea[name="{$v.name}"]', {-->
<!--                                    allowFileManager: true,-->
<!--                                    uploadJson: uploadJson,-->
<!--                                    fileManagerJson: fileManagerJson,-->
<!--                                    afterBlur: function () {-->
<!--                                        this.sync();-->
<!--                                    }-->
<!--                                });-->
<!--                            });-->
<!--                        </script>-->
<!--                        {else/}-->
<!--                        <tr>-->
<!--                            <td width="15%">{:html_entity_decode($v.label)}</td>-->
<!--                            <td>{:html_entity_decode($v.value)}</td>-->
<!--                        </tr>-->
<!--                        {/if}-->
<!--                        {/foreach}-->
                        <tr>
                            <td><label for="">图片<em>*</em></label></td>
                            <td>
                                <button type="button" class="layui-btn u-upload-pic" data-name="image_id"><i class="layui-icon">&#xe67c;</i>上传图片</button>
                                <div class="m-pic">
                                    <ul>
                                        {:attach_html($info.image_id, 'image_id')}
                                    </ul>
                                </div>
                            </td>
                        </tr>
                        <tr hidden>
                            <td><label for="url">链接地址</label></td>
                            <td><input type="text" class="u-ipt u-ipt-long" name="url" id="url" placeholder="请输入链接地址" value="{$info.url}" /></td>
                        </tr>
                        <tr style="display: none">
                            <td width="15%"><label for="">打开方式</label></td>
                            <td>
                                <div class="lay-select">
                                    <select name="target">
                                        <option value="0"{if condition="$info['target'] eq 0"} selected{/if}>原窗口打开</option>
                                        <option value="1"{if condition="$info['target'] eq 1"} selected{/if}>新窗口打开</option>
                                    </select>
                                </div>
                            </td>
                        </tr>
                        <tr hidden>
                            <td width="15%"><label for="">跳转类型</label></td>
                            <td>
                                <div class="lay-select">
                                    <select name="type">
                                        <option value="0"{if condition="$info['type'] eq 0"} selected{/if}>图文</option>
                                        <option value="1"{if condition="$info['type'] eq 1"} selected{/if}>商品</option>
                                        <option value="2"{if condition="$info['type'] eq 2"} selected{/if}>商铺</option>
                                        <option value="3"{if condition="$info['type'] eq 3"} selected{/if}>优惠券</option>
                                        <option value="4"{if condition="$info['type'] eq 4"} selected{/if}>拼团商品</option>
                                        <option value="5"{if condition="$info['type'] eq 5"} selected{/if}>商品列表</option>
                                    </select>
                                </div>
                            </td>
                        </tr>

                        <tr>
                            <td><label for="list_order">排序</label></td>
                            <td><input type="text" class="u-ipt u-ipt-small" name="list_order" id="list_order" placeholder="请输入排序值" value="{$info.list_order ?: 0}" /><span>值越大越排在前面</span></td>
                        </tr>
                        <tr>
                            <td><label for="description">描述</label></td>
                            <td><div class="m-textarea"><textarea name="description" class="u-tarea" id="description" placeholder="请输入描述">{$info.description}</textarea></div></td>
                        </tr>
						
                            <!--<tr>-->
                                <!--<td>区域</td>-->
                                <!--<td>-->
                                    <!--<div class="form-select" style="display: flex">-->
                                        <!--<select name="province" lay-filter="province"></select>-->
                                        <!--<select name="city" lay-filter="city"></select>-->
                                        <!--<select name="district"></select>-->
                                    <!--</div>-->
                                <!--</td>-->
                            <!--</tr>-->
                        </tbody>
                    </table>
                    <div class="m-form-btn"><input type="hidden" name="id" value="{$info.id}"><button id="j_btn" class="u-btn">确定提交</button></div>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="extrajs"}
{include file="public:upload"/}
<!--<script>-->
    <!--layui.use(['layer', 'form'], function(){-->
        <!--var layer  = layui.layer,-->
                <!--form   = layui.form;-->
        <!--var province_id ="{$info.province}";-->
        <!--var city ="{$info.city}";-->
        <!--var district ="{$info.district}";-->
        <!--//城市三级联动-->
        <!--var p_options="";-->
        <!--var c_options="";-->
        <!--var a_options="";-->
        <!--$.getJSON("/static/data/address.json", "", function(data) {-->
            <!--//each循环 使用$.each方法遍历返回的数据date-->
            <!--$.each(data, function(i, item) {-->
                <!--// console.log(item)-->
                <!--p_options+="<option value='"+item.region_id+"'>"+item.region_name+"</option>";-->
                <!--if(item.region_id==province_id){-->
                    <!--$.each(item.child, function(i, citem) {-->
                        <!--c_options+="<option value='"+citem.region_id+"'>"+citem.region_name+"</option>";-->
                        <!--if(citem.region_id==city){-->
                            <!--$.each(citem.child, function(i, aitem) {-->
                                <!--a_options+="<option value='"+aitem.region_id+"'>"+aitem.region_name+"</option>";-->
                            <!--});-->
                        <!--}-->
                    <!--});-->
                <!--}-->
            <!--});-->

            <!--//省-->
            <!--$("select[name='province']").html(p_options);-->
            <!--$("select[name='province'] option").attr("selected",false);-->
            <!--$("select option[value='"+province_id+"']").attr("selected",true);-->

            <!--$("select[name='city']").html(c_options);-->
            <!--$("select[name='city'] option").attr("selected",false);-->
            <!--$("select option[value='"+city+"']").attr("selected",true);-->

            <!--$("select[name='district']").html(a_options);-->
            <!--$("select[name='district'] option").attr("selected",false);-->
            <!--$("select option[value='"+district+"']").attr("selected",true);-->

            <!--form.render('select');-->
        <!--});-->
    <!--});-->
<!--</script>-->
{/block}